<template>
	<view class="content">
		<view class="tishi" v-for="(items,index) in dataTree" :key="index" @click="goSubmit(items)">
			<!--    <u-icon name="map" color="#04BDA5" size="13" bold="true">
	    </u-icon> -->
			<uni-icons type="location" color="#04BDA5" size="30" style="margin-left: 20rpx;"></uni-icons>

			<text class="txt">
				{{items.name || ''}}
			</text>
		</view>
	</view>
</template>

<script setup>
	import {
		onMounted,
		reactive,
		ref,
		watchEffect
	} from 'vue';
	import {
		vehicleLoanOrderApi
	} from '@/api/business/qr/vehicle-loan-order-api';
	import {
		onLoad
	} from '@dcloudio/uni-app';
	let df = ref()
	onLoad((options) => {
		getMapDataFun({
			type: "4", // 1: 省份，2：市，3：区县 4：街道
			provinceCode: "",
			cityCode:"", // 市代码
			areaCode: uni.getStorageSync('areaid'), // 区县代码
		})
	})
	let dataTree = ref([])
	async function getMapDataFun(paramValue) {
		let res = await vehicleLoanOrderApi.getMapDataApi(paramValue)
		dataTree.value = res.data.map(it => {
			return {
				name: it.streetName,
				value: it.streetCode,
			}
		})
	}
	function goSubmit(da) {
		let shengData = JSON.parse(uni.getStorageSync('shengData'))
		let cityata = JSON.parse(uni.getStorageSync('cityata'))
		let areaData = JSON.parse(uni.getStorageSync('areaData'))
		let result = {
			shengData,
			cityata,
			areaData,
			streetData:da
		}
		console.log(result,'结果');
		var pages = getCurrentPages()
		var prevPage = {}
		pages.forEach((items,index) => {
			if (items.route == "pages/addres/zheng") {
				prevPage = pages[index]
				// console.log(prevPage.$vm.unitIndustryData,'你呀你');
				// prevPage.$vm.formData.residentialAddress = JSON.stringify(result)
	if (prevPage && prevPage.receivedData) { // 直接检查是否存在 receivedData
	    prevPage.receivedData = '这是从页面 B 回传的数据';
	}

				// prevPage.$vm.form.cartypeId = val.id
				// prevPage.$vm.form.carPrice = val.maxPrice
				uni.navigateBack({
					delta: 6
				})
				return
			}
		})
	}
</script>

<style>
	.content {
		/* width: 100%; */
		height: 100%;
		background: linear-gradient(215deg, #D9FCF8 0%, #FFFFFF 10%);
		box-shadow: 0rpx 10rpx 20rpx 0rpx rgba(0, 0, 0, 0.1);
		border-radius: 50rpx 50rpx 0rpx 0rpx;
		border: 2px solid #FFFFFF;
		/* margin-top: 26rpx; */
	}


	.tishi {
		position: relative;
		/*width: 650rpx;*/
		height: 80rpx;
		text-align: left;
		background-color: rgba(4, 189, 165, 0.1);
		border-radius: 30rpx;
		margin: 42rpx 50rpx 0 50rpx;
		/*padding-left: 20rpx;*/
		display: flex;
		align-items: center;
		justify-items: center;
	}

	.tishi .u-icon {
		margin-left: 30rpx !important;
	}

	.tishi .txt {
		font-family: PingFang SC;
		font-weight: 400;
		font-size: 24rpx;
		color: #04BDA5;
		margin-left: 4rpx;
	}

	/* .tishi:hover {
		background-color: rgba(6, 119, 107, 0.1);
	} */
	.tishi:hover {
		background-color: #E8F3F2;
		/* 鼠标悬停时的背景色 */
	}
</style>